<?php
/**
 * Created by PhpStorm.
 * User: colin
 * Date: 2017/3/6
 * Time: 16:22
 */

namespace App\Http\Controllers;


use App\Models\Message;
use Illuminate\Http\Request;

class MsgController extends Controller
{
    public function submit(Request $request)
    {

			$rules = [
				'name' => 'required',
				'qq'	=> 'required',
				'email'	=> 'required|email',
				'content'	=> 'required',
			];

			$validator = \Validator::make($request->all(), $rules);

			if ($validator->fails()) {
				return redirect()->back()->withErrors($validator)->withInput();
			}else{
				Message::create($request->all());
				return redirect()->back()->withInput()->with('success', '消息已经提交成功');
			}

			$insert_id = Module::insert("Columns", $request);

			return redirect()->route(config('laraadmin.adminRoute') . '.columns.index');

    }
}